//
//  SucursalCustomCell.m
//  Megatlon
//
//  Created by Leandro Milmanda on 4/8/12.
//  Copyright 2012 www.lemil.com.ar. All rights reserved.
//

#import "SucursalCustomCell.h"

@implementation SucursalCustomCell

@synthesize primaryLabel,secondaryLabel,terciaryLabel,myImageView;

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
        // Initialization code
        primaryLabel = [[[UILabel alloc]init] autorelease];
        primaryLabel.textAlignment = UITextAlignmentLeft;
        primaryLabel.font = [UIFont systemFontOfSize:14];
        secondaryLabel = [[[UILabel alloc]init] autorelease];
        secondaryLabel.textAlignment = UITextAlignmentLeft;
        secondaryLabel.font = [UIFont systemFontOfSize:10];
        terciaryLabel = [[[UILabel alloc]init] autorelease];
        terciaryLabel.textAlignment = UITextAlignmentLeft;
        terciaryLabel.font = [UIFont systemFontOfSize:10];
        myImageView = [[[UIImageView alloc]init] autorelease];
        [self.contentView addSubview:primaryLabel];
        [self.contentView addSubview:secondaryLabel];
        [self.contentView addSubview:terciaryLabel];
        [self.contentView addSubview:myImageView];
        
        UIView *bgColorView = [[[UIView alloc] init] autorelease];
        [bgColorView setBackgroundColor:[UIColor colorWithRed:226.0/255.0 green:131.0/255.0 blue:26.0/255.0 alpha:1.0]];
        [self setSelectedBackgroundView:bgColorView];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGRect contentRect = self.contentView.bounds;
    CGFloat boundsX = contentRect.origin.x;
    CGRect frame;
    double l = 30; 
    double hmax = 42;
    double yoffset = (hmax/2) - (l/2);
    double xoffset = boundsX + 7;
    frame= CGRectMake(xoffset ,yoffset,l, l);
    myImageView.frame = frame;
    xoffset = xoffset + l + 8;
    frame= CGRectMake(xoffset ,1, 280, 16);
    primaryLabel.frame = frame;
    
    frame= CGRectMake(xoffset ,17, 280, 12);
    secondaryLabel.frame = frame;   

    frame= CGRectMake(xoffset ,29, 280, 12);
    terciaryLabel.frame = frame;

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

-(void)dealloc
{
    [super release];
}


@end
